package com.moqianfan.mcuassistant.utils;

import java.text.DecimalFormat;

/**
 * Created by limh on 2016/11/22.
 * 格式化工具
 */

public class FormatUtil {

    public static String formatBps(Object bps) {
        String result;
        DecimalFormat df = new DecimalFormat("#0");
        if (!"".equals(bps))
            result = df.format(bps);
        else
            result = "";
        return result;
    }

    public static String formatTwo(Object bps) {
        String result;
        DecimalFormat df = new DecimalFormat("#0.00");
        if (!"".equals(bps))
            result = df.format(bps);
        else
            result = "";
        return result;
    }

    public static String formatThree(Object bps) {
        String result;
        DecimalFormat df = new DecimalFormat("#0.000");
        if (!"".equals(bps))
            result = df.format(bps);
        else
            result = "";
        return result;
    }
}
